﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace OnlineShop
{
    class User : INameable
    {
        private string name;
        private string password;
        private decimal balance;
        public List<Product> Products = new List<Product>();

        public decimal Balance
        {
            get { return balance; }
            set 
            {
                if (value < 0)
                {
                    throw new ArgumentOutOfRangeException("Balance cannot be less than 0");
                }
                balance = value; 
            }
        }


        public string Password
        {
            get { return password; }
            set { password = value; }
        }

        public string Name
        {
            get
            {
                return this.name;
            }
            set
            {
                if (value.Length <= 2)
                {
                    throw new ArgumentOutOfRangeException("Length of the name must be at least 2 symbols");
                }
                this.name = value;
            }
        }
    }
}
